#!/bin/bash
echo "Installing docker-engine"
PASSWD="up"
# 更新
secho $PASSWD|sudo -S apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
# 安装GPG证书
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
# 写入软件源信息
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
# 更新并安装Docker-CE
sudo apt-get -y update
sudo apt-get -y install docker-ce docker-ce-cli containerd.io

sudo usermod -aG docker $(whoami)
newgrp docker

# 设置缓冲
sudo mkdir -p /etc/docker
## 此处使用自己申请的阿里云docker 镜像地址
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://iuw4a9x7.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

# docker 
docker pull sundx/swarm_docker:kinetic